package StudyCode.summary.myfile;

import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class MoveFileUsingPathResolve {
	public static void main(String[] args) throws Exception {
		Path movefrom = FileSystems.getDefault().getPath("E:\\Copy\\1\\test.txt");
		Path moveto_dir = FileSystems.getDefault().getPath("E:/Copy");

		try {
			Files.move(movefrom, moveto_dir.resolve(movefrom.getFileName()), StandardCopyOption.REPLACE_EXISTING);
			System.out.println("文件移动成功通过 Path.resolve 方法");
		} catch (IOException e) {
			System.err.println(e);
		}

	}
}
